Skip to content

feat: Add initial support for YouTube clip links - #9532

Open
radmorecameron wants to merge 6 commits into
FreeTubeApp:developmentfrom
radmorecameron:add-initial-support-for-clip-links
Open

feat: Add initial support for YouTube clip links#9532
radmorecameron wants to merge 6 commits into
FreeTubeApp:developmentfrom
radmorecameron:add-initial-support-for-clip-links

Conversation

@radmorecameron

@radmorecameron radmorecameron commented Jul 29, 2026

Copy link
Copy Markdown
Member

Pull Request Type

  • Feature Implementation

Related issue

#4323

Description

This PR adds initial support for clip links.

Testing

Desktop

  • OS: Fedora Linux
  • OS Version: 42
  • FreeTube version: latest nightly

@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 29, 2026
@FreeTubeBot
FreeTubeBot enabled auto-merge (squash) July 29, 2026 23:41
Comment thread src/renderer/helpers/api/local.js Outdated
@radmorecameron
radmorecameron marked this pull request as draft July 29, 2026 23:43
auto-merge was automatically disabled July 29, 2026 23:43

Pull request was converted to draft

@github-actions github-actions Bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Jul 29, 2026
@radmorecameron
radmorecameron force-pushed the add-initial-support-for-clip-links branch from 613257f to 1644ed0 Compare August 2, 2026 20:03
@radmorecameron
radmorecameron marked this pull request as ready for review August 2, 2026 20:35
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Aug 2, 2026
@FreeTubeBot
FreeTubeBot enabled auto-merge (squash) August 2, 2026 20:35
@radmorecameron
radmorecameron marked this pull request as draft August 2, 2026 22:43
auto-merge was automatically disabled August 2, 2026 22:43

Pull request was converted to draft

@github-actions github-actions Bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Aug 2, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@radmorecameron
radmorecameron force-pushed the add-initial-support-for-clip-links branch from 2dba6f2 to 9d63ca8 Compare August 24, 2026 22:00
@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@efb4f5ff-1298-471a-8973-3d47447115dc

Copy link
Copy Markdown
Member

Can be undrafted :)

@radmorecameron
radmorecameron force-pushed the add-initial-support-for-clip-links branch from 9d63ca8 to 9f06cb5 Compare August 26, 2026 22:49
@radmorecameron
radmorecameron marked this pull request as ready for review August 26, 2026 22:51
@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Aug 26, 2026
@FreeTubeBot
FreeTubeBot enabled auto-merge (squash) August 26, 2026 22:52

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navigating to the url throws an error

Image

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Aug 28, 2026
@radmorecameron radmorecameron added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Aug 28, 2026
@Shadorc

Shadorc commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Navigating to the URL with Invidious API throws too
image

Comment thread src/renderer/helpers/api/invidious.js Outdated
Comment thread src/renderer/helpers/api/invidious.js Outdated
Comment thread src/renderer/helpers/api/invidious.js Outdated
Comment thread src/renderer/helpers/api/invidious.js Outdated
Co-authored-by: Cameron Radmore <radmorecameron@gmail.com>
@radmorecameron

Copy link
Copy Markdown
Member Author

Both the Invidious and local api should be working now. Issue was a mix of typo + updating the name of a param in my YouTube.js PR and forgetting to reflect that change here.

Comment on lines +2498 to +2506
const parsedParams = ClipParams.decode(Utils.base64ToU8(decodeURIComponent(clipResponse.payload.params)))

return {
videoId,
startTime: parsedParams.clipParamData.startTime / 1000, // convert to seconds
endTime: parsedParams.clipParamData.endTime / 1000, // convert to seconds
clipTitle: parsedParams.clipParamData.clipTitle,
clipMetadata: parsedParams.clipParamData.clipMetadata
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this section of the code is the same for the local and Invidious APIs apart from where the video ID and params string is read from, could you please extract it into a shared function that takes the video ID and params text as the input, decodes it and returns the object.

export async function getClipInvidious(clipId) {
const response = await resolveUrl('https://www.youtube.com/clip/' + clipId)

const parsedParams = ClipParams.decode(Utils.base64ToU8(decodeURIComponent(response.params)))

@absidue absidue Sep 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we cannot treeshake YouTube.js because of Options API components, we exclude the entire YouTube.js dependency in builds where SUPPORTS_LOCAL_API is false (that's also why we use the repairInvidiousManifest function in those builds instead of generating a DASH manifest with YouTube.js). So you either need to gate the Invidious functionality here behind SUPPORTS_LOCAL_API too or use the Invidious clips API endpoint (I know that you originally avoided it here because of performance concerns on their side but using it as a fallback is probably okay).

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants